#include "Time.hpp"

#include <iostream>

Time* Time::instance = NULL;

Time::Time() {
    currentTime = 0.0f;
    deltaTime = 0.0f;
}

void Time::update() {
    float newTime = clock.getElapsedTime().asSeconds();
    deltaTime = newTime - currentTime;
    currentTime = newTime;
}

float Time::now() {
    return currentTime;
}

float Time::step() {
    return deltaTime;
}

Time* Time::getInstance() {
    if(instance == NULL) {
        instance = new Time();
    }

    return instance;
}
